package puf.m2.util;

import java.util.ArrayList;
import java.util.List;

public class ListUtil {
    /**
     * Clone the given list
     * @param listToClone
     * @return a new list with the same elements of the old one.
     */
    public static <T> List<T> cloneList(final List<T> listToClone) {
        return new ArrayList<T>(listToClone);
    }

    /**
     * Concatenate the given small lists
     * @param listsToConcat
     * @return a big list
     */
    @SuppressWarnings("unchecked")
    public static <T> List<T> concat(final List<T> ... listsToConcat) {
        final List<T> bigList = new ArrayList<T>();
        for (final List<T> aList : listsToConcat) {
            bigList.addAll(aList);
        }
        return bigList;
    }
}
